#!/bin/bash

# shellcheck disable=SC2164
# shellcheck disable=SC2046
# shellcheck disable=SC2006
WORK_PATH=$(
  cd $(dirname "$0")
  pwd
)
DOCKER_VERSION=20.10.3

# shellcheck disable=SC2164
cd "$WORK_PATH"

#安装docker
# shellcheck disable=SC2086
tar zxvf docker-$DOCKER_VERSION.tgz
\cp -rf docker/* /usr/bin/
rm -rf docker/
\cp -rf docker.service /usr/lib/systemd/system/docker.service
ln -s /usr/lib/systemd/system/docker.service /etc/systemd/system/multi-user.target.wants/docker.service
systemctl daemon-reload

mkdir -p /etc/docker/
\cp -rf daemon.json /etc/docker/daemon.json

systemctl enable docker
systemctl start docker
#安装docker-composer
\cp -rf docker-compose-linux-x86_64 /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose


systemctl status docker --no-pager
docker --version
docker-compose --version